#!/bin/sh
filename=hdd_check
pid=$$
partern="[6-9][0-9]%\|5[1-9]%"
df -h | grep hda > "$filename$pid.tmp"
index=0
while read line
do
  if grep -q "$partern" <<< $line
  then
    echo "HDD$indexの容量が50%を超えました"
    ((index++))
  fi
done < $filename$$.tmp

#!/bin/sh
while read line
do
  if [ "a" = "b" ]
  then
    echo "bang"
  else
   echo khac
done < file.txt

// ok

#!/bin/sh
while read line
do
echo $line
done < file.txt


ban nhap cung
#!/bin/sh
filename=hdd_check
pid=$$
partern="[6-9][0-9]%\|5[1-9]%"
#df -h | grep hda > $filename$pid.tmp
index=0
while read line
do
  if grep -q $partern <<< $line
  then
    echo "hda$index: HDD capacity has exceeded 50%(japanese font error)"
  fi
  ((index++))
#done < $filename$pid.tmp
done < file.tmp
#rm $filename$pid.tmp

// file.tmp
asd 60% as
asd 61% as
asd 79% as
asd 99% as
asd 50% as
asd 51% as
asd 23% as
asd 30% as
asd 02% as
asd 84% as
asd 72% as
asd 12% sad
sad 2% asd
asdasd
=> ban cuoi cung > 1%

#!/bin/sh
filename=hdd_check
pid=$$
partern="2%"
df -h | grep hda > $filename$pid.tmp
index=0
while read line
do
  if grep -q $partern <<< $line
  then
    echo "hda$index: HDD capacity has exceeded 50%(japanese font error)"
  fi
  ((index++))
done < $filename$pid.tmp
rm $filename$pid.tmp

=> ban cuoi cung
#!/bin/sh
filename=hdd_check
pid=$$
partern="[6-9][0-9]%\|5[1-9]%"
df -h | grep hda > $filename$pid.tmp
index=0
while read line
do
  if grep -q $partern <<< $line
  then
    echo "hda$index: HDD capacity has exceeded 50%(japanese font error)"
  fi
  ((index++))
done < $filename$pid.tmp
rm $filename$pid.tmp